﻿/**
 * ...
 * @author aboutwhat
 */

package format.hxml;

typedef Data = List<Option>;
    
typedef SwfHeader = 
{
    var width : Int;
    var height : Int;
    var color : Int;
    var fps : Int;
}

typedef Resource = 
{
    var file : String;
    var name : String;
}

typedef Remap = 
{
    var source : String;
    var target : String;
}

typedef Library = 
{
    var library : String;
    var version : Null<String>;
}


class OptionTools {
    public static function equals (a : Option, b : Option) {
        return 
        switch (a) {
            case swfHeader(x1) :
                switch (b) { 
                    case swfHeader(x2) : x1.width == x2.width &&
                                         x1.height == x2.height &&
                                         x1.fps == x2.fps &&
                                         x1.color == x2.color;
                    default : false;
                }
            case resource(x1) :
                switch(b) {
                    case resource(x2) : x1.file == x2.file &&
                                        x1.name == x2.name;
                    default : false;
                }
            case remap(x1) :
                switch(b) {
                    case remap(x2) : x1.source == x2.source &&
                                     x1.target == x2.target;
                    default : false;
                }
            case lib(x1) :
                switch(b) {
                    case lib(x2) : x1.library == x2.library &&
                                   x1.version == x2.version;
                    default : false;
                }
            
            
            default : return Type.enumEq(a, b);
        }
    }
}

enum Option 
{
    cp(directory : String);
    js(file : String);
    swf(file : String);
    swf9(file : String);
    as3(directory : String);
    neko(file : String);
    php(directory : String);
    cpp(directory : String);
    xml(file : String);
    main(mainClass : String);
    lib(lib : Library);
    D(constant : String);
    v;
    debug;
    swfVersion(version : Int);
    swfHeader(header : SwfHeader);
    swfLib(lib : String);
    x(file : String);
    resource(resource : Resource);
    exclude(file : String);
    prompt;
    cmd(command : String);
    flashStrict;
    noTraces;
    flashUseStage;
    nekoSource;
    genHxHeaders;
    display;
    noOutput;
    times;
    noInline;
    noOpt;
    phpFront(front : String);
    jsNamespace(namespace : String);
    remap (remap : Remap);
    help;
    next;
}



